#include <stdio.h>
#include <string>
#include <queue>
#include <string.h>

/*
 * 动态规划求可行解，字符串str1和str2当前匹配的位置为状态
 */
using namespace std;

class Status
{
public:
	int p1, p2;

	Status(int p1, int p2)
	{
		this->p1 = p1;
		this->p2 = p2;
	}
};

queue<Status> q;
const int MAX = 205;
int flag[MAX][MAX];

int combine()
{
	memset(flag, 0, sizeof(flag));

	char str1[MAX], str2[MAX], dest[MAX << 1];

	scanf("%s%s%s", str1, str2, dest);
	int p1, p2, p;

	p1 = p2 = p = 0;

	q.push(Status(p1, p2));

	while(!q.empty())
	{
		p1 = q.front().p1;
		p2 = q.front().p2;
		q.pop();

		p = p1 + p2;

		if(dest[p] == 0)
		{
			return 1;
		}

		if(dest[p] == str1[p1])
		{
			if(flag[p1 + 1][p2] == 0)
			{
				q.push(Status(p1 + 1, p2));
				flag[p1+1][p2] = 1;
			}
		}
		if(dest[p] == str2[p2])
		{
			if(flag[p1][p2 + 1] == 0)
			{
				q.push(Status(p1, p2 + 1));
				flag[p1][p2 + 1] = 1;
			}
		}
	}

	return 0;
}

int main()
{
	int n;
	scanf("%d", &n);

	for(int i = 0;i<n;i++)
	{
		printf("Data set %d: ", i + 1);

		if(combine())
			printf("yes\n");
		else
			printf("no\n");
	}
}